﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SARUserControls
{
	/// <summary>
	/// WindowsButton.xaml 的交互逻辑
	/// </summary>
	public partial class WindowsButton : UserControl
	{
		public WindowsButton()
		{
			this.InitializeComponent();
		}

        //定义事件
        public event MouseButtonEventHandler SARMinClick;
        public event MouseButtonEventHandler SARMaxClick;
        public event MouseButtonEventHandler SARCloseClick;



        private void minbtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (SARMinClick != null)
            {
                SARMinClick.Invoke(this, e);
            }
        }

        private void minbtn_MouseEnter(object sender, MouseEventArgs e)
        {
            this.minbtn.Opacity = 0.7;
        }

        private void minbtn_MouseLeave(object sender, MouseEventArgs e)
        {
            this.minbtn.Opacity = 0;
        }

        private void maxbtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (SARMaxClick != null)
            {
                SARMaxClick.Invoke(this, e);
            }
        }

        private void maxbtn_MouseEnter(object sender, MouseEventArgs e)
        {
            this.maxbtn.Opacity = 0.7;
        }

        private void maxbtn_MouseLeave(object sender, MouseEventArgs e)
        {
            this.maxbtn.Opacity = 0;
        }

        private void closebtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (SARCloseClick != null)
            {
                SARCloseClick.Invoke(this, e);
            }
        }

        private void closebtn_MouseEnter(object sender, MouseEventArgs e)
        {
            this.closebtn.Opacity = 0.7;
        }

        private void closebtn_MouseLeave(object sender, MouseEventArgs e)
        {
            this.closebtn.Opacity = 0;
        }
	}
}